package com.mask.chapter01;

import java.io.*;

public class Test5 {
    public static void main(String[] args) {
        File file = new File("fish.jpg"); //源文件
        File back = new File("back.jpg");//复制的文件
        FileInputStream fis = null;
        FileOutputStream fos = null;
        try {
            fis = new FileInputStream(file);
            fos = new FileOutputStream(back);
            byte[] bbuf = new byte[32];
            int hasRead = 0;
            while((hasRead = fis.read(bbuf)) > 0){
                fos.write(bbuf,0,hasRead);
            }
            fos.flush();
        } catch (FileNotFoundException e) {

            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
            finally {
            try {
                fos.close();
                fis.close();
            } catch (IOException e) {
// TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    }

}